import echarts from 'echarts';

export let scale = Math.max(document.body.offsetWidth / 1200, 1)

export function setTitle({text}) {
    return {
        text,
        left: '50%',
        top: 16 * scale,
        textAlign: 'center',
        textStyle: {
            // color: '#FFE166'
            color: '#fff',
            fontSize: 12 * scale,
            fontWeight: 'bolder'
        }
    }
}


export function changeScale() {
    scale = Math.max(document.body.offsetWidth / 1200, 1)
}

export const tooltip = {
    show: true,
    trigger: 'axis',
    showDelay: 0,
    hideDelay: 50,
    transitionDuration: 0,
    backgroundColor: 'rgba(50,50,50,1)',
    borderColor: '#aaa',
    showContent: true,
    borderRadius: 8 * scale,
    padding: 10 * scale,
    textStyle: {
        fontSize: 14 * scale
    }
}

export const baseTextStyle = {
    textStyle: {
        fontSize: 14 * scale
    }
}

export const mapLineStyle = {
    normal: {
        // color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
        //     offset: 0,
        //     color: 'yellow'
        // }, {
        //     offset: 1,
        //     color: 'red'
        // }], false),
        width: 2 * scale,
        opacity: 0.6,
        curveness: 0.2
    }
}


export const mapEffectStyle = {
    show: true,
    constantSpeed: 30 * scale,
    symbol: 'arrow', //ECharts 提供的标记类型包括 'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
    symbolSize: 8 * scale,
    trailLength: 0,
}

export const colors = ['#fc97af', '#87f7cf', '#f7f494', '#c23531', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3']
// export const colors = ['#2295f3', '#d4a4eb', '#ff7d74','#741bb1', '#39b6e9', '#f7c5a0', '#d4a4eb','#d2f5a6',  '#76f2f2', '#bda29a','#6e7074', '#546570', '#c4ccd3']